package com.huilian.iotbox.data.enums;

import lombok.Getter;

@Getter
public enum DouYinVerifyResultEnum {
    SUCCESS(0, "验券成功"),
    FAIL_2(2, "券码已核销"),
    FAIL_3(3, "券码正在退款中（用户主动退款）"),
    FAIL_4(4, "券码已退款"),
    FAIL_5(5, "团购有效期尚未开始"),
    FAIL_6(6, "券码已过期，系统将自动发起退款"),
    FAIL_31(31, "券码退款中（用户申请）"),
    FAIL_32(32, "券码退款中（过期自动退）");

    private Integer code;
    private String desc;

    DouYinVerifyResultEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getResult(Integer code) {
        for (DouYinVerifyResultEnum value : DouYinVerifyResultEnum.values()) {
            if (value.getCode().equals(code)){
                return value.getDesc();
            }
        }
        return "原因未知，错误码：" + code;
    }
}
